package com.dk.service.impl;

import com.dk.mapper.TCategoryMapper;
import com.dk.pojo.TCategory;
import com.dk.pojo.TCategoryExample;
import com.dk.service.TCategoryServiceI;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;

@Service
public class TCategoryServiceImpl implements TCategoryServiceI {
    @Autowired
    private TCategoryMapper tCategoryMapper;

    @Override
    public List<TCategory> getInfoServer() {
        return tCategoryMapper.selectByExample(new TCategoryExample());
    }

    @Override
    public void saveById(TCategory tCategory) {
        tCategoryMapper.insertSelective(tCategory);
    }

    @Override
    public TCategory getUpdateInfo(Integer catId) {
        return tCategoryMapper.selectByPrimaryKey(catId);
    }

    @Override
    public void updateById(TCategory tCategory) {
        tCategoryMapper.updateByPrimaryKeySelective(tCategory);
    }

    @Override
    public void deleteById(Integer catId) {
        tCategoryMapper.deleteByPrimaryKey(catId);
    }

    @Override
    public List<TCategory> getInfo() {
        return tCategoryMapper.selectByExample(new TCategoryExample());
    }
}
